<template>
    <div>
        <el-table :data="dataOne" stripe style="width: 100%">
            <el-table-column prop="product_name" label="作品名称">
            </el-table-column>
            <el-table-column prop="" label="状态">
                <template slot-scope="scope">
                    <span v-text="check_status[dataOne[scope.$index].check_status]"></span>
                    <span style="margin-left: 10px;color:#0A5BC0;cursor: pointer;text-decoration: underline" v-show="dataOne[scope.$index].check_status==3" @click="reason(scope.$index,scope.row)">原因</span>
                </template>
            </el-table-column>
            <el-table-column prop="add_time" label="日期">
            </el-table-column>
            <el-table-column label="操作" width="80">
                <template slot-scope="scope">
                    <span class="span-hover" @click="details(scope.$index,scope.row)">查看详情</span>
                </template>
            </el-table-column>
        </el-table>
        <!--分页-->
        
		<div class="block-pageination clear">
            <el-pagination background class="right" @current-change="handleCurrentChange" :page-size="10" layout="prev, pager, next" :total="total"></el-pagination>
		</div>
    </div>
</template>

<script>
import {
    userregister,
    userDel,
    submitfile,
    signupload,
    orderlist
} from "@/api";
// import ElButton from "../../node_modules/element-ui/packages/button/src/button";
import { mapState, mapMutations } from "vuex";
export default {
    // components: { ElButton },
    data() {
        return {
            pay_status: {
                0: "未支付",
                1: "待支付",
                2: "已支付"
            },
            check_status: {
                0: "未提交",
                1: "审核中",
                2: "审核通过",
                3: "拒绝",
                4: "已发证"
            },
            product_types: {
                "1": "文字",
                "2": "口述",
                "3": "音乐",
                "4": "喜剧",
                "5": "曲艺",
                "6": "舞蹈",
                "7": "杂技艺术",
                "8": "美术",
                "9": "建筑",
                "10": "摄影",
                "11": "模型",
                "12": "电影",
                "13": "电影和类似摄制电影方法创作的作品",
                "14": "工程设计图、产品设计图",
                "15": "地图、示意图",
                "16": "其它"
            },
            dataOne: null,
            total: 0,
            page: 1,
            upload: false,
            dialogVisible: false,
            dialogImageUrl: "",
            uploadUrl: submitfile,
            fileInfo: {
                shenqingbiaoqianzi: {
                    type: "pic",
                    folder: "shenqingbiaoqianzi"
                }
            },
            refuse: false,
            refuseReason: "",
            determine: false,
            copyright_number: null
        };
    },

    computed: {
        ...mapState([
            'croUser',
        ]),
    },
    methods: {
        ...mapMutations([
            'OUT_LOGIN',
        ]),
        // 获取数据
        getList() {
			if(!this.croUser){
				this.OUT_LOGIN();
				this.$router.push('/login');
				return
			}
            let para = {
                cur_uid: this.croUser.user_id,
                id: this.croUser.user_id,
                user_id: this.croUser.user_id,
                page: this.page,
                time: Date.parse(new Date())
            };
            orderlist(para).then(res => {
                if(res.data){
                    this.dataOne = res.data.list;
                    this.total = res.data.total;
                }else if(res.tologin) {
                    this.OUT_LOGIN();
                    this.$router.push('/login');
                }else {
                    this.$message.error(res.msg);
                }
            });
        },
        // 分页
        handleCurrentChange(val) {
            this.page = val;
            this.getList();
        },
        details(index, row) {
            sessionStorage.setItem("copyright_number", row.copyright_number);
            //        this.$router.push("/certificate");
            //        this.$router.push({
            //          path: '/certificate',
            //          query: {copyright_number: row.copyright_number, check_status: row.check_status}
            //        });
            //        this.status = this.$route.query.status;

            if (row.check_status == 0) {
                //          this.$router.push("/copyright");
                this.$router.push({
                    path: "/copyright",
                    query: { copyright_number: row.copyright_number }
                });
            } else {
                this.$router.push({
                    path: "/certificate",
                    query: {
                        copyright_number: row.copyright_number,
                        check_status: row.check_status
                    }
                });
                //          console.log(row)
                sessionStorage.setItem("sample_pic", row.sample_pic);
            }
        }
    },

    mounted() {
        this.getList();
    }
};
</script>
